/*
 * WeightedRoundRobinScheduler.h
 *
 *  Created on: 29-11-2013
 *      Author: Tomasz Lis
 */

#ifndef WEIGHTEDROUNDROBINSCHEDULER_H_
#define WEIGHTEDROUNDROBINSCHEDULER_H_

#include <csimplemodule.h>
#include <vector>
#include <packet_m.h>
#include <fstream>
using namespace std;

class WeightedRoundRobinScheduler : public cSimpleModule {
public:
    vector<int> idsList;
    vector<vector<Packet*>*> queuesList;
    vector<int> weightsList;

    int numberOfDeletedMinPrior;
    int numberOfDeletedMaxPrior;
    int numberOfDeleted;
    int numberOfForward;

    simtime_t lastArrival;
    simtime_t delay;

    cMessage* sendTrigger;
    Packet* errorMsg;
    unsigned int queuesCount;
    signed int queueSize;
    int currentQueue;

    WeightedRoundRobinScheduler();
    virtual ~WeightedRoundRobinScheduler();

    virtual void initialize();
    void handleMessage(cMessage* msg);
    bool receivePacket(Packet* packet);
    int getId(int src);
    bool isWaitingPacket();
    Packet* getPacket();
    virtual void finish();
};

Define_Module(WeightedRoundRobinScheduler);
#endif /* WEIGHTEDROUNDROBINSCHEDULER_H_ */
